<template>
  <div class="header">
    <div class="header-content">
      <div class="header-left">
        <h2 class="title">来首音乐</h2>
        <div class="subtitle">发现更多美好旋律</div>
      </div>
      <div class="search">
        <el-autocomplete
          :prefix-icon="Search"
          placeholder="搜索歌曲、歌手、专辑..."
          @focus="$router.push('/home-music/search')"
          class="search-input"
        />
      </div>
    </div>
    <div class="header-decoration">
      <div class="decoration-circle circle-1"></div>
      <div class="decoration-circle circle-2"></div>
      <div class="decoration-circle circle-3"></div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { Search } from "@element-plus/icons-vue"
</script>

<style scoped lang="scss">
.header {
  height: 80px;
  width: 100%;
  background: var(--gradient-music-primary);
  padding: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);

  .header-content {
    width: 100%;
    max-width: 1280px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: relative;
    z-index: 2;

    .header-left {
      display: flex;
      flex-direction: column;
      gap: 4px;

      .title {
        padding: 0;
        margin: 0;
        font-family: "楷体", "KaiTi", serif;
        font-size: 28px;
        font-weight: 700;
        color: #fff;
        text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
        letter-spacing: 2px;
      }

      .subtitle {
        font-size: 14px;
        color: rgba(255, 255, 255, 0.8);
        font-weight: 400;
        letter-spacing: 1px;
      }
    }

    .search {
      width: 400px;
      display: flex;
      align-items: center;

      .search-input {
        width: 100%;

        ::v-deep(.el-input__wrapper) {
          border-radius: 25px;
          background: rgba(255, 255, 255, 0.95);
          backdrop-filter: blur(10px);
          border: 2px solid rgba(255, 255, 255, 0.3);
          box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
          transition: all 0.3s ease;
          padding: 0 20px;

          &:hover {
            background: rgba(255, 255, 255, 1);
            border-color: rgba(255, 255, 255, 0.5);
            box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
            transform: translateY(-2px);
          }

          &:focus-within {
            background: rgba(255, 255, 255, 1);
            border-color: #409eff;
            box-shadow: 0 8px 25px rgba(64, 158, 255, 0.3);
          }

          .el-input__prefix {
            color: #409eff;
            font-size: 18px;
            margin-right: 8px;
          }

          .el-input__inner {
            color: #303133;
            font-size: 14px;
            font-weight: 500;
            height: 44px;

            &::placeholder {
              color: #909399;
              font-weight: 400;
            }
          }
        }
      }
    }
  }

  .header-decoration {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;

    .decoration-circle {
      position: absolute;
      border-radius: 50%;
      background: rgba(255, 255, 255, 0.1);
      backdrop-filter: blur(5px);

      &.circle-1 {
        width: 120px;
        height: 120px;
        top: -60px;
        right: 10%;
        animation: float 6s ease-in-out infinite;
      }

      &.circle-2 {
        width: 80px;
        height: 80px;
        bottom: -40px;
        left: 15%;
        animation: float 8s ease-in-out infinite reverse;
      }

      &.circle-3 {
        width: 60px;
        height: 60px;
        top: 20px;
        left: 5%;
        animation: float 7s ease-in-out infinite;
      }
    }
  }
}

@keyframes float {
  0%, 100% {
    transform: translateY(0px) rotate(0deg);
  }
  50% {
    transform: translateY(-20px) rotate(180deg);
  }
}

// 响应式设计
@media (max-width: 768px) {
  .header {
    height: 70px;

    .header-content {
      padding: 0 16px;

      .header-left {
        .title {
          font-size: 24px;
        }

        .subtitle {
          font-size: 12px;
        }
      }

      .search {
        width: 280px;
      }
    }
  }
}
</style>
